package com.cn.sl.server.common.dto

import com.cn.sl.server.common.enumerate.QueryMode
import io.swagger.v3.oas.annotations.media.Schema

open class QueryModeDto(
    @field:Schema(description = "查询模式；SIMPLE：简单查询；FULL：复杂查询")
    open val mode: QueryMode = QueryMode.SIMPLE,
    @field:Schema(description = "简单查询的查询内容")
    open val content: String? = null,
    @field:Schema(description = "查询页数")
    open val page: Int = 1,
    @field:Schema(description = "pageSize")
    open val pageSize: Int = 50,
    @field:Schema(description = "多字段排序")
    open val sorts: List<PageSortDto> = arrayListOf(),
    @field:Schema(description = "单字段排序")
    open val sort: PageSortDto? = null,
) {
    val offset: Long
        get() {
            return ((page - 1) * pageSize).toLong();
        }
}